﻿using System;
using System.Collections.Generic;
using OnePiece.Core.Extension.Paging;
using OnePiece.Core.ModelComponent;

namespace OnePiece.Core.RepositoryComponent
{
    public interface IRepositoryComponentBase<TModel>
        where TModel : ModelComponentBase
    {
        int Update(TModel entity);

        int Insert(TModel entity);

        int Delete(TModel entity);

        int Delete(Guid entityId);

        TModel GetById(Guid? entityId);

        IList<TModel> GetByCriteriaWithSelector(Func<TModel, bool> predicate, Func<TModel, TModel> selectSelector);

        IList<TModel> GetAll();

        IList<TModel> GetAllPerPage(ref PageExtensionHelper pager);

        IList<TModel> GetAllByCriteria(Func<TModel, bool> predicate);

        IList<TModel> GetAllByCriteriaPerPage(Func<TModel, bool> predicate, ref PageExtensionHelper pager);

        void RemoveFromRepository(TModel entity);

        void RemoveFromRepository(Guid entityId);

        void RemoveFromRepository(string entityId);

    }
}
